package com.walter.springai.tools;

import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.chat.model.ToolContext;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;

import java.util.Map;

/**
 * 获取销售拜访数据
 */
@Slf4j
public class SaleVisitInfo {

    @Tool(name = "getVisitInfo", description = "获取销售拜访数据")
    public String getVisitInfo(@ToolParam(description = "拜访开始时间，格式yyyy-MM-dd HH:mm:ss", required = false) String startTime,
                               @ToolParam(description = "拜访结束时间，格式yyyy-MM-dd HH:mm:ss", required = false) String endTime,
                              ToolContext toolContext) {
        log.info("startTime: {}, endTime: {}", startTime, endTime);
        Map<String, Object> context = toolContext.getContext();
        log.info("context: {}", context);
        return "用户" + context.get("saleId") + "拜访了100个店铺";
    }
}
